<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"> 
	<head>
		<meta charset="utf-8">
		<title>添加职位</title>
		
		<!-- 引入layui支持 -->
		<script type="text/javascript" th:src="@{/js/jquery.min.js}" ></script>
		<script type="text/javascript" th:src="@{/js/afquery.js}" ></script>
		<script type="text/javascript" th:src="@{/layui/layui.all.js}" ></script>
		<link rel="stylesheet" th:href="@{/layui/css/layui.css}" />
		
		<style>
			.title{
				font-weight: 700;
				line-height: 28px;
				font-size: 20px;
				width: 505px;
				overflow: hidden;
				white-space: nowrap;
				text-align: center;
			}
		</style>
		
	</head>
	
	<body>
	<div>
		
		<div class="title">
			[[${title}]]
		</div>
		<br><hr /><br>
		
		<!-- 岗位新增 -->
		<form class="layui-form " lay-filter="test2">
		  <div class="layui-form-item">
			<label class="layui-form-label">职位名称</label>
			<div class="layui-input-block">
			  <input type="text" name="title" required  lay-verify="required" placeholder="(推荐格式:地址+工作类型+岗位+条件:渝北汽配厂招普工16岁女)" autocomplete="off" class="layui-input">
			</div>
		  </div>
		  <div class="layui-form-item">
			<label class="layui-form-label">工作地址</label>
			<div class="layui-input-block">
			  <input type="text" name="workaddress" th:value="${address}" required  lay-verify="required" placeholder="请输入工作地址" autocomplete="off" class="layui-input">
			</div>
		  </div>
		  <div class="layui-form-item">
			<label class="layui-form-label">经验要求</label>
			<div class="layui-input-block">
			  <select name="experience" lay-verify="required">
				<option value="0">经验不限</option>
				<option value="1">1年以下</option>
				<option value="2">1-3年</option>
				<option value="3">3-5年</option>
				<option value="4">5-10年</option>
				<option value="5">10年以上</option>
			  </select>
			</div>
		  </div>
		  <div class="layui-form-item">
			<label class="layui-form-label">学历要求</label>
			<div class="layui-input-block">
			  <select name="academicDegree" lay-verify="required">
				<option value="0">学历不限</option>
				<option value="1">高中</option>
				<option value="2">技校</option>
				<option value="3">中专</option>
				<option value="4">大专</option>
				<option value="5">本科</option>
				<option value="6">硕士</option>
				<option value="7">博士</option>
			  </select>
			</div>
		  </div>
		  <div class="layui-form-item">
			  <div class="layui-inline">
			  <label class="layui-form-label">薪资范围</label>
			  <div class="layui-input-inline" style="width: 100px;">
			    <input type="text" name="wagesmin" required  lay-verify="required|number" placeholder="￥" autocomplete="off" class="layui-input">
			  </div>
			  <div class="layui-form-mid">-</div>
			  <div class="layui-input-inline" style="width: 100px;">
			    <input type="text" name="wagesmax" required  lay-verify="required|number" placeholder="￥" autocomplete="off" class="layui-input">
			  </div>
			</div>
		  </div>
		  <div class="layui-form-item">
			<label class="layui-form-label">招聘人数</label>
			<div class="layui-input-block">
			  <input type="text" name="hiring" required  lay-verify="required|number" placeholder="请输入招聘人数(个)" autocomplete="off" class="layui-input">
			</div>
		  </div>
		  <div class="layui-form-item" pane>
			<label class="layui-form-label">职位优势</label>
			<div class="layui-input-block">
			  <input type="checkbox" th:each="row:${labelList}" th:name="${row.id}" th:title="${row.title}">
			</div>
		  </div>
		  <div class="layui-form-item layui-form-text">
			<label class="layui-form-label">职位详情</label>
			<div class="layui-input-block">
			  <textarea name="content" required  lay-verify="required" placeholder="请输入职位详情(待遇/要求/福利...)" class="layui-textarea"></textarea>
			</div>
		  </div>
		  <div class="layui-form-item">
			<div class="layui-input-block">
			  <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
			  <button type="reset" class="layui-btn layui-btn-primary">重置</button>
			</div>
		  </div>
		</form>
		
		
	</div>
	</body>
	
	<script>
		
		layui.use('form', function(){
			var form = layui.form,
				upload = layui.upload,
				layer = layui.layer;
			form.render(null, 'test2'); //更新 lay-filter="test2" 所在容器内的全部状态
			
			// 监听表单提交
			form.on('submit(formDemo)', function(data){
				data.field.company = [[${company}]];
				
				var req = data.field;
				Af.rest('[[@{/postsave.do}]]', req, function(data){
					layer.msg("发布成功！");
					$('.layui-btn-primary').trigger("click");  // 模拟点击一下
				});
				return false;
			});
			
			
		});
		
	</script>
	
</html>
